package com.hfi.security.app.social;

import com.hfi.security.core.social.SocialAuthenticationFilterPostProcessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import org.springframework.social.security.SocialAuthenticationFilter;
import org.springframework.stereotype.Component;

/**
 * @author ChangLiang
 * @date 2019/9/2
 */
@Component
public class AppSocialAuthenticationPostProcessor implements SocialAuthenticationFilterPostProcessor {

    @Autowired
    private AuthenticationSuccessHandler hfiAuthenticationSuccessHandler;

    /**
     * 将其成功处理器设置为我们返回令牌的成功处理器
     * @param socialAuthenticationFilter
     */
    @Override
    public void process(SocialAuthenticationFilter socialAuthenticationFilter) {
            socialAuthenticationFilter.setAuthenticationSuccessHandler(hfiAuthenticationSuccessHandler);
    }
}
